######  StudentContext.cs:

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using MVC文件夹.Models;
namespace MVC文件夹.Data
{
    public class StudentContext:DbContext
    {

        public DbSet<Student>? Students{get;set;}
        protected override void OnConfiguring(DbContextOptionsBuilder builder)
        {
            var con="server=.;uid=sa;pwd=123456;database=WWW;Encrypt=Ture;TrustServerCertificate=Ture";
            builder.UseSqlServer(con);
        }
    }
}   

}
```

###### Course.cs:

```
namespace MVC文件夹.Models;
public class CourseModel
{
public int Id{get;set;}

public string? CName{get;set;}
}
```

Student.cs

```
namespace MVC文件夹.Models;
public class StudentModel
{
public int Id{get;set;}

public string? Name{get;set;}

public string? Ger {get;set;}
}
```

###### MVC文件夹.csproj:

```
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameWorkCore" Version="7.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.1">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameWorkCore.SqlServer" Version="7.0.1" />
  </ItemGroup>

</Project>

```